<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="/images/favicon.ico"  type="image/x-icon">
    <title>试卷创编</title>

    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <!--dashboard calendar-->
    <link href="/css/clndr.css" rel="stylesheet">

    <!--pickers css-->
    <link rel="stylesheet" type="text/css" href="/js/bootstrap-datepicker/css/datepicker-custom.css" />
    <link rel="stylesheet" type="text/css" href="/js/bootstrap-timepicker/css/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="/js/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" type="text/css" href="/js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
    <link rel="stylesheet" type="text/css" href="/js/bootstrap-datetimepicker/css/datetimepicker-custom.css" />

    <!--common-->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/jquery.stepy.css" rel="stylesheet">
    <link href="/css/style-responsive.css" rel="stylesheet">
    <script type="text/css">
        .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
            cursor: not-allowed;
            background-color: #fff;
            opacity: 1;
            text-align: center;
        }
    </script>
</head>

<body class="sticky-header">

<!--左侧开始-->
<div th:replace="~{admin/commons/common :: commonleft}"></div>
<!--左侧结束-->
<!--头部开始-->
<div th:replace="~{admin/commons/common :: commonheader}"></div>
<!--头部结束-->

<!--主页面开始-->
<div class="main-content" >


    <!--当前位置介绍开始-->
    <div class="page-heading">
        <h3>
            试卷创编
        </h3>
        <ul class="breadcrumb">
            <li>
                <a href="#">卷库管理</a>
            </li>
            <li class="active"> 试卷创编 </li>
        </ul>
    </div>
    <!-- 当前位置介绍结束-->


    <!--body wrapper start-->
    <div class="wrapper">
            <!--随机创建1开始-->
            <div class="col-md-12">
            <section class="panel">
                <header class="panel-heading">
                    随机创建......
                    <span class="tools pull-right">
                                <a class="fa fa-chevron-down" id="openAndClose" href="javascript:;"></a>
                                <a class="fa fa-times" href="javascript:;"></a>
                    </span>
                </header>
                <div class="panel-body">
                    <form class="form-horizontal" id="for" th:action="@{admin/createPaperOpt}">

                        <div class="form-group ">
                            <label class="control-label col-md-1" style="float: left;"> 试卷名</label>
                            <div class="col-md-4">
                                <input type="text" class="form-control" name="paperName" id="paperName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-1">单选题数</label>
                            <div class="col-md-4">
                                <div id="single">
                                    <div class="input-group input-small">
<!--                                        设置只能输入数字-->
                                        <input type="text" class="spinner-input form-control" maxlength="3" value="0" name="singleSelectNumber" id="singleSelectNumber"
                                               onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                                        <div class="spinner-buttons input-group-btn btn-group-vertical">
                                            <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incNumber($('#singleSelectNumber'))">
                                                <i class="fa fa-angle-up"></i>
                                            </button>
                                            <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disNumber($('#singleSelectNumber'))">
                                                <i class="fa fa-angle-down"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-md-1">多选题数</label>
                            <div class="col-md-4">
                                <div id="moreSelectNum">
                                    <div class="input-group input-small">
                                        <input type="text" class="spinner-input form-control" maxlength="3" value="0" name="moreNumber" id="moreNumber" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                                        <div class="spinner-buttons input-group-btn btn-group-vertical">
                                            <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incNumber($('#moreNumber'))">
                                                <i class="fa fa-angle-up"></i>
                                            </button>
                                            <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disNumber($('#moreNumber'))">
                                                <i class="fa fa-angle-down"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-1">判断题数</label>
                            <div class="col-md-4">
                                <div >
                                    <div class="input-group input-small">
                                        <input type="text" class="spinner-input form-control" maxlength="3" value="0" name="judgeNumber" id="judgeNumber" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >
                                        <div class="spinner-buttons input-group-btn btn-group-vertical">
                                            <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incNumber($('#judgeNumber'))">
                                                <i class="fa fa-angle-up"></i>
                                            </button>
                                            <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disNumber($('#judgeNumber'))">
                                                <i class="fa fa-angle-down"></i>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>

<!--                            <label class="control-label col-md-1">判断题分值</label>-->
<!--                            <div class="col-md-4">-->
<!--                                <div id="judgeScoreD">-->
<!--                                    <div class="input-group input-small">-->
<!--                                        <input type="text" class="spinner-input form-control" maxlength="3" value="1" name="judgeScore" id="judgeScore" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">-->
<!--                                        <div class="spinner-buttons input-group-btn btn-group-vertical">-->
<!--                                            <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incScore($('#judgeScore'))">-->
<!--                                                <i class="fa fa-angle-up"></i>-->
<!--                                            </button>-->
<!--                                            <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disScore($('#judgeScore'))">-->
<!--                                                <i class="fa fa-angle-down"></i>-->
<!--                                            </button>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
                        </div>


                        <div class="form-group">
                            <label class="control-label col-md-1"> 开始时间</label>
                            <div class="col-md-4">
                                <div class="input-group date form_datetime-component">
                                    <input type="text" class="form-control" readonly="" size="16" name="startTime" id="startTime">
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-md-1">结束时间</label>
                            <div class="col-md-4">
                                <div class="input-group date form_datetime-component">
                                    <input type="text" class="form-control" readonly="" size="16" name="endTime" id="endTime">
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                    </span>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-12" style="float:right">
                            <a target="_blank" href="#">Tips：随机从题库中抽取题目进行创建，且题目项不会重复，注意题目数最多100题。</a>
                            <a class="btn btn-success btn-sm " style="float:right" onclick="createPaper()"><i class="fa fa-check"></i> 开始创建 </a>
                        </div>

                    </form>


                    <!--隐藏域-->
                    <input id="successPaperName" class="hidden">
                </div>
            </section>
        </div>

            <!--随机创建2开始-->
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                        自定义随机创建......
                        <span class="tools pull-right">
                                <a class="fa fa-chevron-down" id="d" href="javascript:;"></a>
                                <a class="fa fa-times" href="javascript:;"></a>
                        </span>
                    </header>
                    <div class="panel-body">
                <h4 class="fw-title">按步骤完成即可创建试卷</h4>
                <div class="box-widget">
                    <div class="widget-head clearfix">
                        <div id="top_tabby" class="block-tabby pull-left">
                        </div>
                    </div>
                    <div class="widget-container">
                        <div class="widget-block">
                            <div class="widget-content box-padding">
                                <form id="stepy_form" class=" form-horizontal left-align form-well">
                                    <fieldset title="Step 1" onclick="paperInfo()">
                                        <legend>初始化</legend>
                                        <div class="form-group ">
                                            <label class="control-label col-md-1" style="float: left;"> 试卷名</label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control" name="paperName1" id="paperName1" required>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-1"> 开始时间</label>
                                            <div class="col-md-4">
                                                <div class="input-group date form_datetime-component">
                                                    <input type="text" class="form-control" readonly="" size="16" name="startTime1" id="startTime1" required>
                                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-1">结束时间</label>
                                            <div class="col-md-4">
                                                <div class="input-group date form_datetime-component">
                                                    <input type="text" class="form-control" readonly="" size="16" name="endTime1" id="endTime1" required>
                                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </fieldset>
                                    <fieldset title="Step 2" onclick="paperInfo()">
                                        <legend>单选题选择</legend>

                                            <div class="form-group s" th:each="type0 :${typeList}">
                                                <div class="control-label col-md-6">
                                                    <label class="control-label col-md-2">单选数</label>
                                                    <div class="col-md-3">
                                                    <div id="singleChoice">
                                                        <div class="input-group input-small" >
                                                            <input type="text" class="spinner-input form-control valid" maxlength="3" value="0" th:name="'singNumber'+${type0.getQPool()}" th:id="'singId'+${type0.getQPool()}"
                                                                   onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                                                            <div class="spinner-buttons input-group-btn btn-group-vertical">
                                                                <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incNumber1(this.parentNode.parentNode.children[0])">
                                                                    <i class="fa fa-angle-up"></i>
                                                                </button>
                                                                <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disNumber1(this.parentNode.parentNode.children[0])">
                                                                    <i class="fa fa-angle-down"></i>
                                                                </button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                    <label  class=" control-label col-md-2">题库</label>
                                                    <div class="btn-group col-md-3">
                                                        <button class="btn btn-warning dropdown-toggle" data-toggle="dropdown" type="button">请选择题库 <span class="caret"></span></button>
                                                        <ul role="menu" class="dropdown-menu" style="text-align: left">
                                                            <li  th:each="type :${typeList}" >
                                                                <a th:value="${type.getQPool()}" th:text="${type.getQType()}"
                                                                   th:onclick="questionPool1([[${type.getQPool()}]],[[${type.getQType()}]],
                                                                   this.parentNode.parentNode.parentNode.children[2],this.parentNode.parentNode.parentNode.children[0])"
                                                                   style="width: 100%" href="javascript:void(0);">
                                                                </a></li>
                                                        </ul>
                                                        <input class="hidden" th:id="'singPool'+${type0.getQPool()}" th:name="'singPool'+${type0.getQPool()}">
                                                    </div>
                                                </div>
                                            </div>

                                        <div class="form-group">
                                            <div class="col-md-5">
                                                <button type="button" class="btn btn-sm btn-success" onclick="addLine()"><i class="fa fa-plus"></i>添加选项</button>
                                                <button type="button" class="btn btn-sm btn-danger" onclick="reduceLine()"><i class="fa fa-minus"></i>减少选项</button>
                                            </div>
                                        </div>
                                    </fieldset>
                                    <fieldset title="Step 3" onclick="paperInfo()">
                                        <legend>多选题选择</legend>

                                        <div class="form-group m" th:each="type1 :${typeList}">
                                            <div class="control-label col-md-5">
                                                <label class="control-label col-md-2">多选数</label><div class="col-md-3">
                                                <div id="moreChoice">
                                                    <div class="input-group input-small" >
                                                        <input type="text" class="spinner-input form-control valid" maxlength="3" value="0" th:name="'moreNumber'+${type1.getQPool()}" th:id="'moreId'+${type1.getQPool()}"
                                                               onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
                                                        <div class="spinner-buttons input-group-btn btn-group-vertical">
                                                            <button type="button" class="btn spinner-up btn-xs btn-default" onclick="incNumber1(this.parentNode.parentNode.children[0])">
                                                                <i class="fa fa-angle-up"></i>
                                                            </button>
                                                            <button type="button" class="btn spinner-down btn-xs btn-default" onclick="disNumber1(this.parentNode.parentNode.children[0])">
                                                                <i class="fa fa-angle-down"></i>
                                                            </button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                                <label  class=" control-label col-md-2">分类</label>
                                                <div class="btn-group col-md-3">
                                                    <button id="questionTypeButton2" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" type="button">题目类型 <span class="caret"></span></button>
                                                    <ul role="menu" class="dropdown-menu" style="text-align: left">
                                                        <li  th:each="type :${typeList}" >
                                                            <a th:value="${type.getQPool()}" th:text="${type.getQType()}"
                                                               th:onclick="questionPool1([[${type.getQPool()}]],[[${type.getQType()}]],
                                                                   this.parentNode.parentNode.parentNode.children[2],this.parentNode.parentNode.parentNode.children[0])"
                                                               style="width: 100%" href="javascript:void(0);">
                                                            </a></li>
                                                    </ul>
                                                    <input class="hidden" th:id="'morePool'+${type1.getQPool()}" th:name="'morePool'+${type1.getQPool()}"  >
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <div class="col-md-5">
                                                <button type="button" class="btn btn-sm btn-success" onclick="addLine2()"><i class="fa fa-plus"></i>添加选项</button>
                                                <button type="button" class="btn btn-sm btn-danger" onclick="reduceLine2()"><i class="fa fa-minus"></i>减少选项</button>
                                            </div>
                                        </div>

                                    </fieldset>
                                    <fieldset title="Step 4" onclick="paperInfo()">
                                        <legend>完成创建</legend>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">本次考试试卷名:</label>
                                            <label id="paperNameInf" class="control-label col-md-2" style="float: left;"></label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">开始时间:</label>
                                            <label id="startInf" class="control-label col-md-2" style="float: left;"></label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">结束时间:</label>
                                            <label id="endInf" class="control-label col-md-2" style="float: left;"></label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">单选数:</label>
                                            <label id="singleInf" class="control-label col-md-2" style="float: left;"></label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">多选数:</label>
                                            <label id="moreInf" class="control-label col-md-2" style="float: left;"></label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">共:</label>
                                            <label id="questionTotal" class="control-label col-md-2" style="float: left;"></label>
                                            <label class="control-label col-md-1" style="float: left;">题</label>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-2" style="float: left;">点击完成即可创建试卷——></label>
                                        </div>
                                    </fieldset>
                                    <button onclick="diySubmit()" type="button" class="finish btn btn-info btn-extend"> 完成!</button>
                                </form>
                                <div class="col-md-12" style="float:right">
                                    <a target="_blank" href="#">Tips：选定题目数量后需指定所属题库，否则按未命名题库处理！</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    </div>
                </section>
        </div>

            <!--自定义创建开始-->
            <div class="col-md-12">
            <section class="panel">
                <header class="panel-heading">
                    自定义创建......
                    <span class="tools pull-right">
                                <a class="fa fa-chevron-down" href="javascript:;"></a>
                                <a class="fa fa-times" href="javascript:;"></a>
                        </span>
                </header>
                <div class="panel-body">
                    <div class="form-group col-md-12 ">
                        <label class="control-label col-md-1" style="float: left;"> 试卷名</label>
                        <div class="col-md-4">
                            <input type="text" class="form-control" name="paperName2" id="paperName2"  required>
                        </div>
                    </div>
                    <div class="form-group col-md-12">
                        <label class="control-label col-md-1"> 开始时间</label>
                        <div class="col-md-4">
                            <div class="input-group date form_datetime-component">
                                <input type="text" class="form-control" readonly="" size="16" name="startTime2" id="startTime2" required>
                                <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                    </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group col-md-12">
                        <label class="control-label col-md-1">结束时间</label>
                        <div class="col-md-4">
                            <div class="input-group date form_datetime-component">
                                <input type="text" class="form-control" readonly="" size="16" name="endTime2" id="endTime2" required>
                                <span class="input-group-btn">
                                        <button type="button" class="btn btn-primary date-set"><i class="fa fa-calendar"></i></button>
                                    </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group col-md-12 d" th:each="type : ${typeList}">
                        <div class="col-md-5">
                            <button type="button" class="btn btn-sm btn-success" th:onclick="cfqBank([[${type.getQPool()}]],[[${type.getQType()}]])" th:text="'从'+${type.getQType()}+'中选择'"></button>
                            <a th:id="'poolButtonA_'+${type.getQType()}"></a>
                            <input class="hidden pool"  th:value="${type.getQPool()}" >
                            <input class="hidden" th:id="'pool_'+${type.getQPool()}+'choice'" value="" >
                            <input class="hidden" th:id="'type_'+${type.getQPool()}+'choice'" value="">
                            <input class="hidden" th:id="'single_'+${type.getQPool()}+'choice'" value="">
                            <input class="hidden" th:id="'more_'+${type.getQPool()}+'choice'" value="">
                        </div>
                    </div>
                    <div class="form-group col-md-12">
                        <a class="btn btn-success btn-sm " style="float:right" onclick="completeC()"><i class="fa fa-check"></i> 完成 </a>
                    </div>
                </div>
            </section>
        </div>

            <!--弹出框开始-->
            <div class="col-md-12 ">
            <a href="#myModal2" data-toggle="modal" class="btn btn-warning hidden" id="tip2">
                提示按钮
            </a>
            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal2" class="modal fade" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header" id="modelColor" style="background:#65CEA7">
                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                            <h4 class="modal-title">提示</h4>
                        </div>
                        <div class="modal-body">
                            <p id="paperCreateTips"></p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default hidden" data-dismiss="modal" onclick="toLook()" id="toLook">去查看</button>
                            <button type="button" class="btn btn-default hidden" data-dismiss="modal" id="cancel">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <!--弹出框结束-->

            <!--从题库选择Model开始-->
            <div class="col-md-12 ">
            <a href="#myModal1" data-toggle="modal" class="btn btn-warning hidden" id="cButton">
            </a>
            <input type="text" class="hidden" id="poolInModel">
            <input type="text" class="hidden" id="typeInModel">
            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal1" class="modal fade" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header" style="background:#65CEA7">
                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                            <h4 class="modal-title">从题库中选择</h4>
                        </div>
                        <div class="modal-body">
                            <div class="col-sm-12 icheck" id="paperObjectList" >
                                <div id="startSingSelect" >
                                </div>
                                <div id="choice">
                                    <div class="form-check single-row " id="r_A">
                                        <div class="radio">
                                            <input tabindex="3" type="radio"   name="r_choice" value="A" style="display: none">
                                            <div> A </div>
                                            <div id="radio_A"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal" onclick="checkedQ($('#poolInModel').val(),$('#typeInModel').val())">确定</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <!--从题库选择Model结束-->

            <!--试卷详情model-->
            <div class="col-md-12 ">
            <a href="#myModal3" data-toggle="modal" class="btn btn-warning hidden" id="pDetail">
            </a>
            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal3" class="modal fade" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header" style="background:#65CEA7">
                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                            <h4 class="modal-title">试卷详情</h4>
                        </div>
                        <div class="modal-body">
                            <div class="col-sm-12 icheck" id="detail—" >
                                <div class="form-group col-md-12">
                                    <label class="form-group col-md-3" style="float: left;"> 试卷名</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid" id="d_paperName">
                                    </div>
                                </div>
                                <div class="form-group col-md-12 ">
                                    <label class="form-group col-md-3" style="float: left;"> 开始时间</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid" id="d_startTime">
                                    </div>
                                </div>
                                <div class="form-group col-md-12 ">
                                    <label class="form-group col-md-3" style="float: left;"> 结束时间</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid" id="d_endTime">
                                    </div>
                                </div>
                                <div class="form-group col-md-12 ">
                                    <label class="form-group col-md-3" style="float: left;"> 单选数</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid"  id="d_singleNumber">
                                    </div>
                                </div>
                                <div class="form-group col-md-12 ">
                                    <label class="form-group col-md-3" style="float: left;"> 多选数</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid" id="d_moreNumber">
                                    </div>
                                </div>
                                <div class="form-group col-md-12 ">
                                    <label class="form-group col-md-3" style="float: left;"> 总共</label>
                                    <div class="col-md-6">
                                        <input type="text" class="form-control valid" id="d_allNumber">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-success" data-dismiss="modal" onclick="createPaperAllDIY()">创建</button>
                            <button type="button" class="btn btn-warning" data-dismiss="modal" >取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <!--试卷详情model-->

            <!--提示model-->
            <div class="col-md-12 ">
            <a href="#myModal0" data-toggle="modal" class="btn btn-warning hidden" id="diySuggest">
            </a>
            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal0" class="modal fade" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header" style="background:#65CEA7" id="diySuggestionColor">
                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                            <h4 class="modal-title">提示</h4>
                        </div>
                        <div class="modal-body">
                            <p id="diySuggestionTip"></p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default hidden" data-dismiss="modal" id="diySuggestionYes">确定</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <!--提示model-->

    </div>

    <!--body wrapper end-->

    <!--footer section start-->
    <footer>
        2022 &copy;<a href="https://www.pdsu.edu.cn/" target="_blank">平顶山学院软件应用双创实验室提供技术支持</a>
    </footer>
    <!--footer section end-->


</div>
<!--主页面结束-->

<div th:replace="~{admin/commons/common :: commonupdatePwd}"></div>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="/js/jquery-1.10.2.min.js"></script>
<script src="/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="/js/jquery-migrate-1.2.1.min.js"></script>
<script src="/js/jquery.validate.min.js"></script>
<script src="/js/jquery.stepy.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/modernizr.min.js"></script>
<script src="/js/jquery.nicescroll.js"></script>

<!--pickers plugins-->
<script type="text/javascript" src="/js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="/js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/js/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="/js/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="/js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="/js/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<!--pickers initialization-->
<script src="/js/pickers-init.js"></script>

<!--spinner-->
<script type="text/javascript" src="/js/fuelux/js/spinner.min.js"></script>
<script src="/js/spinner-init.js"></script>


<!--表单校验-->
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script src="js/validation-init.js"></script>

<!--common scripts for all pages-->
<script src="/js/scripts.js"></script>
<script type="text/javascript">


    /*=====STEPY WIZARD====*/
    $(function() {
        $('#default').stepy({
            backLabel: 'Previous',
            block: true,
            nextLabel: 'Next',
            titleClick: true,
            titleTarget: '.stepy-tab'
        });
    });

    /*=====STEPY WIZARD WITH VALIDATION====*/
    $(function() {
        $('#stepy_form').stepy({
            backLabel: '上一步',
            nextLabel: '下一步',
            errorImage: true,
            block: true,
            description: true,
            legend: false,
            titleClick: true,
            titleTarget: '#top_tabby',
            validate: true
        });
        $('#stepy_form').validate({
            errorPlacement: function(error, element) {
                $('#stepy_form div.stepy-error').append(error);
            },
            rules: {
                'paperName1': 'required',
                'startTime1': 'required',
                'endTime1': 'required'
            },
            messages: {
                'paperName1': {
                    required: '试卷名未填写!'
                },
                'startTime1': {
                    required: '考试开始时间未填写!'
                },
                'endTime1': {
                    required: '考试结束时间未填写!'
                }
            }
        });
    });

    //随机创建题目
    function createPaper() {
        var paperName = $('#paperName').val()
        var singleSelectNumber = $('#singleSelectNumber').val()
        var moreSelectNumber = $('#moreNumber').val()
        var judgeNumber = $('#judgeNumber').val()
        var startTime0 = $('#startTime').val()
        var endTime0 = $('#endTime').val()
        startTime = dateFormat(startTime0)
        endTime = dateFormat(endTime0)
        var sum = parseInt(singleSelectNumber) + parseInt(moreSelectNumber)
        if(parseInt(singleSelectNumber) < 1 || parseInt(moreSelectNumber) < 1){
            $('#toLook').addClass('hidden')
            $('#cancel').text('确定').removeClass('hidden')
            if(parseInt(singleSelectNumber) < 1){
                $('#modelColor').attr('style','background : #bb1f1f')
                $('#paperCreateTips').text('单选题数小于1，无法创建！')
                $('#tip2').click()
            }
            else if(parseInt(moreSelectNumber) < 1){
                $('#modelColor').attr('style','background : #bb1f1f')
                $('#paperCreateTips').text('多选题数小于1，无法创建！')
                $('#tip2').click()
            }
        }
        else if(sum > 100){
            $('#cancel').text('确定').removeClass('hidden')
            $('#modelColor').attr('style','background : #bb1f1f')
            $('#paperCreateTips').text('试题数大于100，无法创建！')
            $('#tip2').click()
        }
        else{
            $.ajax({
                //请求路径
                url: "/admin/createPaperOperate",
                //请求类型
                type: "POST",
                //data表示发送的数据
                data: JSON.stringify({
                    paperName:paperName,
                    singleSelectNumber:singleSelectNumber,
                    moreSelectNumber:moreSelectNumber,
                    judgeNumber:judgeNumber,
                    startTime:startTime,
                    endTime:endTime
                }), //定义发送请求的数据格式为JSON字符串
                contentType: "application/json;charset=utf-8",
                //定义回调响应的数据格式为JSON字符串，该属性可以省略
                dataType: "json",
                //成功响应的结果
                success: function (data) {
                    if(data.code == 200){
                        $('#toLook').removeClass('hidden')
                        $('#cancel').text('确定').removeClass('hidden')
                        $('#modelColor').attr('style','background : #65CEA7')
                        $('#paperCreateTips').text('试卷：'+data.paperName+'创建成功！')
                        $('#tip2').click()
                    }
                    if(data.code == 500){
                        $('#modelColor').attr('style','background : #bb1f1f')
                        if(data.hasPaper == true){
                            $('#paperCreateTips').text('试卷：'+data.paperName+'创建失败！原因：该试卷已存在，不可重复创建。')
                            $('#tip2').click()
                            $('#toLook').removeClass('hidden')
                            $('#cancel').text('确定').removeClass('hidden')
                        }
                        else if (data.hasError!=null){
                            $('#toLook').addClass('hidden')
                            $('#cancel').text('确定').removeClass('hidden')
                            $('#paperCreateTips').text('试卷：'+data.paperName+'创建失败！原因:'+data.hasError)
                            $('#tip2').click()
                        }
                    }
                },

            })
        }
    }

    //查看
    function toLook() {
        var pName = $('#successPaperName').val()
        window.location.replace('/admin/toPaperList'+'?searchName='+pName)
    }
    
    //日期格式化
    function dateFormat(date) {

        var arr = date.split(' ')
        var dd = parseInt(arr[0])
        if (dd<10) {
            var strDd = '0'+dd
        }
        if(dd>10)
            strDd = dd
        var monthArr = ['January','February','March','April','May','June','July','August','September','October','November','December']
        var month = 0
        var year = arr[2]
        var time = arr[4]+':00'
        for(var i =0; i<12; i++){
            if(arr[1]==monthArr[i]){
                month = month+i+1
                if (month < 10) {
                    month = '0'+ month
                }
            }
        }
        var Time =  year+'-'+month+'-'+strDd+'T'+time
        return Time;
    }

    //增加题目数
    function incNumber(object){
        if (object.val()==null||object.val()==''){
            object.attr('value',0)
        }
        //获取数值，转int
        var num = parseInt(object.val())
        num = num+5
        //题数[0,100]范围
        if(num >= 0 && num <= 100){
            object.attr('value',num)
        }
    }

    //减少题目数
    function disNumber(object){
        if (object.val()==null||object.val()==''){
            object.attr('value',0)
        }
        //获取数值，转int
        var num = parseInt(object.val())
        num = num-5
        if(num >= 0){
            object.attr('value',num)
        }
    }

    //增加分数
    function incScore(object) {
        if (object.val()==null||object.val()==''){
            object.attr('value',0)
        }
        //获取数值，转int
        var score = parseInt(object.val())
        score = score+1
        //题数[0,20]范围
        if(score >= 0){
            object.attr('value',score)
        }
    }

    //减少分数
    function disScore(object) {
        if (object.val()==null||object.val()==''){
            object.attr('value',0)
        }
        //获取数值，转int
        var score = parseInt(object.val())
        score = score-1
        //题数[0,20]范围
        if(score >= 0){
            object.attr('value',score)
        }
    }

    //随机创建2的初始化
    $(document).ready( function() {
        //初始化时候先获取pool的个数并将其隐藏
        var arr = document.getElementsByClassName('form-group s')
        for (var i =0; i < arr.length; i++){
            arr[i].setAttribute('class','hidden form-group s')
        }
        //pool数量>3 将前三个显示出来剩余的根据用户自己选择是否隐藏
        if(arr.length >=3){
            for (var i =0; i < 3; i++){
                arr[i].setAttribute('class','form-group s')
            }
        }
        //pool数量<3将pool全部显示出来
        if(arr.length < 3){
            for (var i =0; i < arr.length; i++){
                arr[i].setAttribute('class','form-group s')
            }
        }
        var arr2 = document.getElementsByClassName('form-group m')
        for (var i =0; i < arr2.length; i++){
            arr2[i].setAttribute('class','hidden form-group m')
        }
        for (var i =0; i < 3; i++){
            arr2[i].setAttribute('class','form-group m')
        }
        $('#openAndClose').click()
        $('#d').click()
    })

    //随机创建2增加题目数
    function incNumber1(object){
        //获取数值，转int
        var num = parseInt(object.value)
        num = num+5
        //题数[0,100]范围
        if(num >= 0 && num <= 100){
            object.value = num
        }
    }

    //随机创建2减少题目数
    function disNumber1(object){
        //获取数值，转int
        var num = parseInt(object.value)
        num = num-5
        //题数[0,100]范围
        if(num >= 0 && num <= 100){
            object.value = num
        }
    }

    //选择分类触发
    function questionPool1(va,te,_input,_button){
        $(_input).attr('value',va)
        _button.innerHTML = te
    }

    //单选增加选项：
    function addLine(){
        var arr = document.getElementsByClassName('hidden form-group s')
        if(arr.length==0){
            $('#diySuggestionYes').text('确定').removeClass('hidden')
            $('#diySuggestionColor').attr('style','background : #65CEA7')
            $('#diySuggestionTip').text('种类数达到上限！')
            $('#diySuggest').click()
        }
        if(arr.length>0){
            arr[0].setAttribute('class','form-group s')
        }
    }

    //多选增加选项：
    function addLine2(){
        var arr = document.getElementsByClassName('hidden form-group m')
        if(arr.length==0){
            $('#diySuggestionYes').text('确定').removeClass('hidden')
            $('#diySuggestionColor').attr('style','background : #65CEA7')
            $('#diySuggestionTip').text('种类数达到上限！')
            $('#diySuggest').click()
        }
        if(arr.length>0){
            arr[0].setAttribute('class','form-group m')
        }
    }


    //单选减少选项
    function  reduceLine(){
        var arr = document.getElementsByClassName('form-group s')
        var arr2 = document.getElementsByClassName('hidden form-group s')
        if(arr.length-arr2.length==1){
            $('#diySuggestionYes').text('确定').removeClass('hidden')
            $('#diySuggestionColor').attr('style','background : #bb1f1f')
            $('#diySuggestionTip').text('最少一个种类！')
            $('#diySuggest').click()
        }
            for(var i =arr.length-1 ;i > 0;i--){
                if(arr[i].getAttribute('class')=='form-group s'){
                    arr[i].setAttribute('class','hidden form-group s')
                    break;
                }
            }
        //设置不可见的选项的内容为0
        for(var i =arr.length-1 ;i > 0;i--){
            if(arr[i].getAttribute('class')=='hidden form-group s'){
                arr[i].children[0].children[1].children[0].children[0].children[0].value = 0
            }
        }

    }

    //减少选项
    function  reduceLine2(){
        var arr = document.getElementsByClassName('form-group m')
        var arr2 = document.getElementsByClassName('hidden form-group m')
        if(arr.length-arr2.length==1){
            $('#diySuggestionYes').text('确定').removeClass('hidden')
            $('#diySuggestionColor').attr('style','background : #bb1f1f')
            $('#diySuggestionTip').text('最少一个种类！')
            $('#diySuggest').click()
        }
        for(var i =arr.length-1 ;i > 0;i--){
            if(arr[i].getAttribute('class')=='form-group m'){
                arr[i].setAttribute('class','hidden form-group m')
                break;
            }
        }
        //设置不可见的选项的内容为0
        for(var i =arr.length-1 ;i > 0;i--){
            if(arr[i].getAttribute('class')=='hidden form-group m'){
                alert(i)
                arr[i].children[0].children[1].children[0].children[0].children[0].value = 0
            }
        }

    }

    // 修改密码
    $("#pwd_btn").click(function() {
        $("#pwd_btn").blur();
        if (confirm("是否确定修改?")){
            var submit = true;
            var oldPwd = $("#oldPwd").val(); //原始密码
            var newPwd = $("#newPwd").val(); //新密码1
            var newPwd2 = $("#newPwd2").val(); //新密码2

            if ((oldPwd && newPwd && newPwd2) == '') {
                $("#tip").html("密码不能为空");
                $("#tip").show();
                submit = false;
            }
            if(submit){
                $.ajax({
                    type:"post",
                    url:"/admin/updatePwd",
                    data: JSON.stringify({
                        oldPwd : oldPwd,
                        newPwd : newPwd,
                        newPwd2 : newPwd2
                    }),
                    contentType: "application/json;charset=utf-8",
                    //定义回调响应的数据格式为JSON字符串，该属性可以省略
                    dataType: "json",
                    success:function (data){
                        if(data.code == 200 ){
                            $("#tip").hide();
                            $("#pwd_form").submit();
                            alert("修改成功，请重新登录!")
                            window.location.href = "/user/logout"
                        }else if(data.code != 200){
                            $("#tip").html(data.info);
                            $("#tip").show();
                        }
                    }
                });
            }
        }
    });

    //随机创建2试卷信息
    function paperInfo() {
        //获取自定义创建考试名、开始时间、结束时间
        var paperName = $('#paperName1').val()
        var startTime0 = $('#startTime1').val()
        var endTime0 = $('#endTime1').val()
        startTime1 = dateFormat(startTime0)
        endTime1 = dateFormat(endTime0)
        //获取所有的单选题的数量跟对应的类型
        var singleNum = parseInt('0')
        var moreNum = parseInt('0')
        var singleInputNumber = document.getElementsByClassName('form-group s')
        for(var i =1;i<singleInputNumber.length;i++){
            var num = parseInt($("#singId"+parseInt(i)+"").val())
            singleNum = num+singleNum
        }
        var moreInputNumber = document.getElementsByClassName('form-group m')
        for(var i =1;i<singleInputNumber.length;i++){
            var num = parseInt($("#moreId"+parseInt(i)+"").val())
            moreNum = num+moreNum
        }
        $('#paperNameInf').html(paperName)
        $('#startInf').html(startTime1)
        $('#endInf').html(endTime1)
        $('#singleInf').html(singleNum)
        $('#moreInf').html(moreNum)
        $('#questionTotal').html(singleNum+moreNum)
    }


    //json数据长度
    function getGsonLength(json){
        var jsonLength=0;
        for (var i in json) {
            jsonLength++;
        }
        return jsonLength;
    }

    //后台数据响应到Model中
    function cfqBank(pool,type) {
        $.ajax({
            //请求路径
            url: "/admin/showQuestionByPool",
            //请求类型
            type: "POST",
            //data表示发送的数据
            data: JSON.stringify({
                pool:pool
            }), //定义发送请求的数据格式为JSON字符串
            contentType: "application/json;charset=utf-8",
            //定义回调响应的数据格式为JSON字符串，该属性可以省略
            dataType: "json",
            //成功响应的结果
            success: function (data) {
                $('#poolInModel').attr('value',pool)
                $('#typeInModel').attr('value',type)
                //获取所有的选项div
                document.getElementById('r_A').className = 'form-check single-row '
                //获取题目数
                var length = getGsonLength(data.questionObjectList)
                // 删除所有克隆的节点
                var f = document.getElementById("startSingSelect");
                var childs = f.childNodes;
                for(var i = childs.length - 1; i >= 0; i--) {
                    f.removeChild(childs[i]);
                }

                for(var i = 0; i < length; i++){
                    var choiceTitle = data.questionObjectList[i].titleContent
                    //创建一个节点p用来放选项标题
                    var p = $("<p id='choiceTitle"+i+"'" +"</p>")
                    $('#startSingSelect').append(p)
                    p.text(i+1+"."+choiceTitle)
                    $('#startSingSelect').append()
                    //创建一个多选放到p标签内
                    var input = $("<input id='input"+i+"'"+" name=checkedQ"+" type=checkbox"+" value="+i+">")
                    //设置一个hidden的input存放真实qid
                    var input1 = $("<input id='input"+i+"'"+" class=hidden"+" name=checkedH"+" type=checkbox"+" value="+data.questionObjectList[i].qid+">")
                    //隐藏域存放题目类型
                    var input2 = $("<input id='input"+i+"'"+" class=hidden"+" value="+data.qTypeList[i]+">")
                    //将input标签追加到p标签内
                    $("#choiceTitle"+i+"").append(input).append(input1).append(input2)
                    //获取选项的数量
                    var choiceNum = getGsonLength(data.questionObjectList[i].questionItemObjects)
                    for(var j = 0; j < choiceNum; j++){
                        var prefix = data.questionObjectList[i].questionItemObjects[j].prefix
                        var choiceContent = data.questionObjectList[i].questionItemObjects[j].content
                        //获取要克隆的节点
                        var cloneDiv = document.getElementById('r_A')
                        var clone = document.getElementById('r_A').cloneNode(true)
                        clone.id='r_A_clone'
                        //设置属性
                        clone.children[0].children[1].innerHTML = prefix
                        clone.children[0].children[2].innerHTML = choiceContent
                        var par = document.getElementById('startSingSelect')
                        par.appendChild(clone)
                    }
                }
                document.getElementById('r_A').className = 'form-check single-row hidden'
                $('#tip1').click()
            },
        })
        $('#cButton').click()

    }

    //点击model中的确定触发
    function checkedQ(pool,type) {
        //ids显示用户选择
        var ids="";
        //用户真实选择qId
        var realIds = ""
        //用户选择的该题的类型
        var qSingleNum = 0
        var qMoreNum = 0
        var total = 0
        $("input[name='checkedQ']").each(function() {
            if (this.checked == true)
            {
                ids += parseInt(this.value)+1 + "、";
                realIds += this.parentNode.children[1].getAttribute('value')+","
                //获得该题的类型
                var type = this.parentNode.children[2].getAttribute('value')
                if(type == 1)
                {
                    qSingleNum = qSingleNum + 1
                }
                if(type == 2)
                {
                    qMoreNum = qMoreNum + 1
                }
                total = qSingleNum + qMoreNum
            }
        }
        );
        if(ids==""){
            $("#poolButtonA_"+type).text('暂未选择题目！')
        }else{
            ids = ids.substring(0,ids.length-1)
            $("#poolButtonA_"+type).text('选择了'+type+'中的 '+ids+' 题！其中单选'+qSingleNum+'道,'+'多选'+qMoreNum+'道,共'+total+'道。')
            //用户真正选的题目qId
            $("#pool_"+pool+"choice").attr('value',realIds)
            //一共多少题
            $("#type_"+pool+"choice").attr('value',total)
            //单选
            $("#single_"+pool+"choice").attr('value',qSingleNum)
            //多选
            $("#more_"+pool+"choice").attr('value',qMoreNum)
        }

    }

    function completeC() {
        dPaper()
        $('#pDetail').click()
    }

    //加载试卷详情
    function dPaper() {
        var len = document.getElementsByClassName('form-group col-md-12 d').length
        var singleTotal = 0
        var moreTotal = 0
        var allTotal = 0
        var pools = document.getElementsByClassName('hidden pool')
        var poolArr = {}
        for(var i=0;i<pools.length;i++){
            poolArr[i] = parseInt($(pools[i]).val())
        }


        for(var i = 0; i < pools.length; i++){
            var qTypeTemp =  $("#type_"+poolArr[i]+"choice").val();
            var singleTemp = $("#single_"+poolArr[i]+"choice").val();
            var moreTemp = $("#more_"+poolArr[i]+"choice").val();
            if (qTypeTemp!=""){
                allTotal += parseInt(qTypeTemp)
            }
            if (singleTemp!=""){
                singleTotal += parseInt(singleTemp)
            }
            if (moreTemp!=""){
                moreTotal += parseInt(moreTemp)
            }
            $('#d_paperName').attr('value',$('#paperName2').val())
            $('#d_startTime').attr('value',$('#startTime2').val())
            $('#d_endTime').attr('value',$('#endTime2').val())
            $('#d_singleNumber').attr('value',singleTotal)
            $('#d_moreNumber').attr('value',moreTotal)
            $('#d_allNumber').attr('value',allTotal)
        }

    }

    //随机创建2
    function diySubmit() {
        //获取自定义创建考试名、开始时间、结束时间
        var paperName = $('#paperName1').val()
        var startTime0 = $('#startTime1').val()
        var endTime0 = $('#endTime1').val()
        startTime1 = dateFormat(startTime0)
        endTime1 = dateFormat(endTime0)
        //获取所有的单选题的数量跟对应的类型
        var singleNumArray = {}
        var singlePoolArray = {}
        var singleInputNumber = document.getElementsByClassName('form-group s')
        for(var i =0;i<singleInputNumber.length;i++){
            var singNum = $("#singId"+parseInt(i+1)+"").val()
            var singPool = $("#singPool"+parseInt(i+1)+"").val()
            if(singNum!=0){
                //用户未选择题目所属题库
                if(singPool == ''){
                    singPool = parseInt('0')
                }
                singleNumArray[i] = singNum
                singlePoolArray[i] = singPool
            }
        }
        //获取所有的多选题的数量跟对应的类型
        var moreNumArray = {}
        var morePoolArray = {}
        var moreInputNumber = document.getElementsByClassName('form-group m')
        for(var i =0;i<moreInputNumber.length;i++)
        {
            var moreNum = $("#moreId"+parseInt(i+1)+"").val()
            var morePool = $("#morePool"+parseInt(i+1)+"").val()
            if(moreNum!=0){
                //用户未选择题目所属题库
                if(morePool == ''){
                    morePool = parseInt('0')
                }
                moreNumArray[i] = moreNum
                morePoolArray[i] = morePool
            }
        }
        $.ajax({
            //请求路径
            url: "/admin/createPaperDiy",
            //请求类型
            type: "POST",
            //data表示发送的数据
            data: JSON.stringify({
                paperName:paperName,
                startTime:startTime1,
                endTime:endTime1,
                singleNumArray:singleNumArray,
                singlePoolArray:singlePoolArray,
                moreNumArray:moreNumArray,
                morePoolArray:morePoolArray
            }), //定义发送请求的数据格式为JSON字符串
            contentType: "application/json;charset=utf-8",
            //定义回调响应的数据格式为JSON字符串，该属性可以省略
            dataType: "json",
            //成功响应的结果
            success: function (data) {
                if(data.code==200){
                    $('#toLook').removeClass('hidden')
                    $('#cancel').text('确定').removeClass('hidden')
                    $('#modelColor').attr('style','background : #65CEA7')
                    $('#paperCreateTips').text('试卷：'+data.paperName+'创建成功！')
                    $('#tip2').click()
                }
                if(data.code == 500){
                    $('#modelColor').attr('style','background : #bb1f1f')
                    if(data.hasPaper == true){
                        $('#paperCreateTips').text('试卷：'+data.paperName+'创建失败！原因：该试卷已存在，不可重复创建。')
                        $('#tip2').click()
                        $('#toLook').removeClass('hidden')
                        $('#cancel').text('确定').removeClass('hidden')
                    }
                    else if (data.hasError!=null){
                        $('#toLook').addClass('hidden')
                        $('#cancel').text('确定').removeClass('hidden')
                        $('#paperCreateTips').text('试卷：'+data.paperName+'创建失败！原因:'+data.hasError)
                        $('#tip2').click()
                    }
                }
            },
        })
    }

    //完全自定创建触发
    function createPaperAllDIY() {
        //获取自定义创建考试名、开始时间、结束时间
        var paperName = $('#paperName2').val()
        var startTime0 = $('#startTime2').val()
        var endTime0 = $('#endTime2').val()
        startTime1 = dateFormat(startTime0)
        endTime1 = dateFormat(endTime0)
        var singleNumber = parseInt($('#d_singleNumber').val())
        var moreNumber = parseInt($('#d_moreNumber').val())
        //获取已有题库的个数
        var len = document.getElementsByClassName('form-group col-md-12 d').length
        var pools = document.getElementsByClassName('hidden pool')
        var poolArr = {}
        for(var i=0;i<pools.length;i++){
            poolArr[i] = parseInt($(pools[i]).val())
        }
        //获取选择的所有题目id
        var qIdStr = "";
        for(var i = 0; i < pools.length; i++){
          var qIdTemp =  $("#pool_"+poolArr[i]+"choice").val();
          if (qIdTemp!=""){
              qIdStr = qIdTemp + qIdStr
          }
        }
        $.ajax({
            //请求路径
            url: "/admin/createPaperAllDiy",
            //请求类型
            type: "POST",
            //data表示发送的数据
            data: JSON.stringify({
                qIdStr:qIdStr,
                paperName: paperName,
                startTime: startTime1,
                endTime: endTime1,
                singleNumber:singleNumber,
                moreNumber:moreNumber
            }), //定义发送请求的数据格式为JSON字符串
            contentType: "application/json;charset=utf-8",
            //定义回调响应的数据格式为JSON字符串，该属性可以省略
            dataType: "json",
            //成功响应的结果
            success: function (data) {
                if(data.code==200){
                    alert('创建成功！')
                }
                if(data.code == 500){
                    alert(data.message)
                }
            },
        })

    }

    jQuery(document).ready(function() {
        EditableTable.init();
    });
    document.getElementById("paper-create").className="active";
    document.getElementById("menu3").className="menu-list nav-active";
</script>

</body>


</html>
<script>
    import Form_advanced_components from "./form_advanced_components.html";
    export default {
        components: {Form_advanced_components}
    }
</script>